@model PagedList.IPagedList<ShivamEMR.Model.Domain.UserDomain.User>

@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Layout.cshtml";  
}

 

<h2>Index</h2>

 

<p>
    @Html.ActionLink("Create New", "Create")
</p>

@using (Html.BeginForm())
{
    <p>
        Find by Name/User Name/Role: @Html.TextBox("SearchString")  
        <input type="submit" value="Search" /></p>
}



<table>
    <tr>
        <th></th>
       
        <th>
            UserCode
        </th>
        <th>
            Name
        </th>
       @* <th>
            Password
        </th>
        <th>
            Notes
        </th>*@
        <th>
            Role
        </th>       
        <th>
            Rights
        </th>
        <th>
            Log
        </th>
        <th>
            Messages
        </th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.ActionLink("Edit", "Edit", new { id=item.ID }) |
            @Html.ActionLink("Details", "Details", new { id=item.ID }) |
            @Html.ActionLink("Delete", "Delete", new { id=item.ID })
        </td>
        
        <td>
			@item.UserCode
        </td>
        <td>
			@item.Name
        </td>
       @* <td>
			@item.Password
        </td>
        <td>
			@item.Notes
        </td>*@
        <td>
			@Html.DisplayTextFor(_ => item.Role.Role).ToString()
        </td>        
        <td>
			@(item.Rights == null ? "None" : item.Rights.Count.ToString())
        </td>
        <td>
			@(item.Log == null ? "None" : item.Log.Count.ToString())
        </td>
        <td>
			@(item.Messages == null ? "None" : item.Messages.Count.ToString())
        </td>
    </tr>
}

</table>

 
 <div>
    Page @(Model.PageCount < Model.PageNumber ? 0 : Model.PageNumber)
    of @Model.PageCount
     
    @if (Model.HasPreviousPage)
    {
        @Html.ActionLink("<<", "Index", new { page = 1, sortOrder = ViewBag.CurrentSort, currentFilter=ViewBag.CurrentFilter  })
        @Html.Raw(" ");
        @Html.ActionLink("< Prev", "Index", new { page = Model.PageNumber - 1, sortOrder = ViewBag.CurrentSort, currentFilter=ViewBag.CurrentFilter  })
    }
    else
    {
        @:<<
        @Html.Raw(" ");
        @:< Prev
    }
     
    @if (Model.HasNextPage)
    {
        @Html.ActionLink("Next >", "Index", new { page = Model.PageNumber + 1, sortOrder = ViewBag.CurrentSort, currentFilter=ViewBag.CurrentFilter  })
        @Html.Raw(" ");
        @Html.ActionLink(">>", "Index", new { page = Model.PageCount, sortOrder = ViewBag.CurrentSort, currentFilter=ViewBag.CurrentFilter  })
    }
    else
    {
        @:Next >
        @Html.Raw(" ")
        @:>>
    }
</div>

